/******************************************************************************/
/* temp_def.h                                                                 */
/******************************************************************************/

#ifndef __TEMP_DEF_H
#define __TEMP_DEF_H


/*************************** Constants TEMP ***********************************/
#define CONVERS_TIME          (TIMER0_TICK)      // 1 sec
#define TEMP_ANTIDREBEZG      (2)                // Antidr value x 2sec
#define TEMP_D1_EVENT         (0x00000001)
#define TEMP_D2_EVENT         (0x00000002)
#define TEMP_D3_EVENT         (0x00000004)

/************************ Prototypes for TEMP *********************************/
typedef enum
{
    eTEMP_D1 = 0,
    eTEMP_D2,
    eTEMP_D3,
    eTEMP_END
} __eIND_TEMP;


typedef enum
{
    eTEMP_NORM_STABLE = 0,           // Temp norm stable state
    eTEMP_MAX_ON_ANTI,               // Temp max on-anti
    eTEMP_MIN_ON_ANTI                // Temp min on-anti
} __eSTATE_TEMP;                     // Type TEMP state


#pragma pack(1)
typedef struct
{
    uint8_t    action;
    sint16_t   tempMaxOn;
    sint16_t   tempMaxOff;
} __BAND_TEMP;                       // Type TEMP band


typedef struct
{
    __BAND_TEMP band[4];
} __SETT_TEMP;                       // Type TEMP sett


typedef struct
{
    uint8_t uid[8];
} __UID_D_TEMP;                      // Type TEMP sett 
#pragma pack()


typedef struct
TOOLS_TEMP
{
    TOOLS_TEMP() : bandState(0), bandIndex(0) {
        bands[0] = (-32768);
        bands[1] = bands[2] = (+32767);
        bands[3] = bands[4] = (+32767);
        bands[5] = bands[6] = (+32767);
        bands[7] = bands[8] = (+32767);
        bands[9] = (+32767);

        action[0] = action[1] = 0;
        action[2] = action[3] = 0;
        action[4] = 0;
    }

    sint16_t  bands[10];
    uint8_t   uid[8];
    uint8_t   action[5];
    uint8_t   bandState;
    uint8_t   bandIndex;
    uint8_t   timer;
} __TOOLS_TEMP;                      // Type TEMP tools


typedef struct
{
    sint16_t  tempx[eTEMP_END];
} __DATA_TEMP;                       // Type TEMP data


typedef struct
FLG_TEMP
{
    FLG_TEMP() : isNeedSearch(FALSE_T) {}

    bool_t  isNeedSearch;
} __FLG_TEMP;                        // Type TEMP flg

#endif